<template>
  <rx-layout>
    <div slot="center" style>
      <rx-fit>
        <div slot="toolheader" foldheader="true" foldbtn="true" border="false">
          <div class="table-page-search-wrapper">
            <a-form layout="inline">
              <a-row :gutter="24">
                <a-col :span="8">
                  <a-form-item :label="i18n('form.authorPerson','权限转移人')">
                    <rx-input-button :placeholder="i18n('form.authorPerson','权限转移人','input')" :single="false" v-model="queryParam.Q_AUTHOR_PERSON__S_LK"
                                     @click="selectUser"></rx-input-button>
                  </a-form-item>
                </a-col>
                <a-col :span="8">
                  <a-form-item :label="i18n('form.targetPerson','目标转移人')">
                    <rx-input-button :placeholder="i18n('form.targetPerson','目标转移人','input')" :single="false" v-model="queryParam.Q_TARGET_PERSON__S_LK"
                                     @click="selectUser">
                    </rx-input-button>
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <span class="table-page-search-submitButtons">
                <a-button @click="$refs.table.loadData()" icon="search" type="primary">{{$ti18('rxList.searchBtn','查询')}}</a-button>
                <a-button @click="resetSearch" style="margin-left: 4px">{{$ti18('rxList.resetBtn','重置')}}</a-button>
                  </span>
                </a-col>
              </a-row>
            </a-form>
          </div>
          <div class="table-operator">
            <a-dropdown v-if="removeEnable && selectedRowKeys.length > 0">
              <a-button type="danger" icon="delete" @click="delByIds(selectedRowKeys)">{{$ti18('rxList.delBtn','删除')}}</a-button>
            </a-dropdown>
          </div>
        </div>
        <rx-grid
          ref="table"
          :bordered="isBorder"
          :allowRowSelect="true"
          :multiSelect="true"
          :columns="columns"
          :defaultPageSize="10"
          url="/api-system/system/core/sysTransferLog/queryUser"
          :queryParam="queryParam"
          data-field="result.data"
          :pageSizeOptions="['10','30','40']"
          id-field="id"
          @selectChange="onSelectChange"
          @rowDblClick="onRowClick"
        >
          <span slot="action" slot-scope="{ text, record }" class="actionIcons">
            <span v-if="removeEnable" @click.stop="delByIds([record.id])">{{$ti18('rxList.delBtn','删除')}}</span>
            <span v-if="removeEnable" @click.stop="onRowClick(record)">{{$ti18('rxList.detailBtn','明细')}}</span>
          </span>
        </rx-grid>
      </rx-fit>
    </div>
  </rx-layout>
</template>

<script>
  import SysTransferLogApi from '@/api/system/core/sysTransferLog'
  import SysTransferLogEdit from './SysTransferLogEdit'
  import SysTransferLogGet from "./SysTransferLogGet";
  import {BaseList, Dialog, RxInputButton} from "@lowcode/jpaas-common-lib";

  export default {
    name: 'SysTransferLogList',
    mixins: [BaseList],
    components: {
      RxInputButton
    },
    data() {
      return {
        columns: [
          {
            title: this.$ti18('rxList.index','序号'),
            type: 'indexColumn',
            width: 60,
            dataIndex: 'serial',
            scopedSlots: {customRender: 'serial'}
          },
          {title: this.i18n('form.authorPerson','权限转移人'), dataIndex: 'authorPersonName',width: 120},
          {title: this.i18n('form.targetPerson','目标转移人'), dataIndex: 'targetPersonName',width: 120},
          {title: this.$ti18('rxForm.createTime','创建时间'), dataIndex: 'createTime',width: 120},
          {title: this.$ti18('rxList.action','操作'), dataIndex: 'action', scopedSlots: {customRender: 'action'},width: 120}
        ],
        component: SysTransferLogEdit,
        comment: this.i18n('list.comment','权限转移日志表'),
        widthHeight: ['800px', '420px']
      }
    },
    methods: {
      i18n(name,text,key){
          return this.$ti18(name,text,"SysTransferLog",key);
      },
      delById(ids) {
        return SysTransferLogApi.del({ids: ids.join(',')});
      },
      getListByParams(parameter) {
        return SysTransferLogApi.query(parameter)
      },
      selectUser(vm) {
        Dialog.openUserDialog({
          curVm: this, data: {single: true}, widthHeight: ['1000px', '600px']
        }, function (self, data) {
          vm.setVal(data.userId, data.fullName);
        })
      },
      onRowClick(record) {
        var conf = {
          pkId: record.pkId,
          component: SysTransferLogGet,
          title: this.i18n('list.detail','明细') + this.comment,
          widthHeight: this.widthHeight
        };
        this.handleEdit(conf);
      }
    }
  }
</script>
<style scoped>

</style>

